<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="{% static '/css/index.css' %}"/>
    <script src="{% static '/js/jquery-3.2.1.min.js' %}"></script>
    <title>用户注册</title>
    <script>
        $(function () {
            $("#butn").click(function () {
                let username = $("#username").val();
                if (username == "" || username == undefined) {
                    alert("用户名不能为空！！！");
                    return;
                }
                let $tel = $("#tele")
                let tellRegex =/^1[3-9]\d{9}$/
                if ($tel.val() == "" || $tel.val() == undefined) {
                    alert("手机号不能为空！！！");
                    return;
                }
                if(!tellRegex.test($tel.val())){
                    alert("请输入正确手机号格式！")
                    return;
                }
                let $password = $("#password")
                if ($password.val() == "" || $password.val() == undefined) {
                    alert("密码不能为空！！！")
                    return;
                }
                if($password.val().length<=6){
                    alert("密码不能少于七位数")
                    return;
                }
                let pswd = $("#pswd").val()
                if (pswd != $password.val()) {
                    alert("密码不一致，请重新输入！！！");
                    return;
                }
                let $email = $("#email")
                {#let emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;#}
                let emailRegex = /^[1-9]\d{4,10}@qq\.com$/
                if (!emailRegex.test($email.val())) {
                    alert("请输入正确的邮箱格式！")
                    return;
                }
                if ($email.val() == "" || $email.val() == undefined) {
                    alert("邮箱不能为空！！！");
                    return;
                }
                $("#myform").submit()
            })
        })
    </script>
</head>
<body>
<header>
    <div class="lf">
        <a class="home" href="{% url 'index' %}">系统首页</a>
        <!-- <a href="bbs.html">论坛</a> -->
        <a href="upload.html">上传资料</a>
    </div>
    <div id="search">
        <input type="text" name="name"
               placeholder="请输入要搜索的资源" autocomplete="off"/><a class="search btn">搜索</a>
    </div>

    <div class="rf">
        <a href="{% url 'auth:userlogin' %}">登录/注册</a>
        <a class="info" href="personal.html">个人中心</a>
        <a class="cols" href="shoucang.html">收藏</a>
        <a class="exit" href="{% url 'auth:userlogout' %}">退出登录</a>
    </div>
</header>


<article>
    <!-- 网站主体 -->
    <div id="main">
        <section class="ct">
            <!-- 上传表单-->
            <div class="upload">
                <h1>用户注册①<em>填写信息、完成用户注册第一步。已有账号，请点击<a
                        href="{% url 'auth:userlogin' %}">登录</a></em></h1>
                <!-- 注册步骤导航-->
                <div class="reg_step">
                    <a class="step">注册信息</a><a class="step2">基本信息</a><a class="step2">注册完成</a>
                </div>

                <form action="{% url 'auth:userregister' %}" autocomplete="off" id="myform" method="post">
                    <p>
                        <label>用户名：</label>
                        <input id="username" class="upt" type="text" name="username" value=""/>
                        <em></em>
                    </p>
                    <p>
                        <label>手机号：</label>
                        <input id="tele" class="upt" type="text" name="phone" value=""/>
                        <em></em>
                    </p>
                    <p>
                        <label>密码：</label>
                        <input id="password" class="upt" type="password" name="password" value=""
                               placeholder="密码长度为6-20位"/>
                        <em></em>
                    </p>
                    <p>
                        <label>确认密码：</label>
                        <input id="pswd" class="upt" type="password" value="" placeholder="请再次输入密码"/>
                        <em></em>
                        <span class="source-tag-msg">两次输入的密码必须保持一致</span>
                    </p>

                    <p>
                        <label>电子邮箱：</label>
                        <input id="email" class="upt" type="email" name="email" value="" placeholder="请输入邮箱"/>
                        <em></em>
                        <span id="emailMes" class="source-tag-msg">您丢失密码后找回密码的凭证</span>
                    </p>
                    <p><input type="button" class="btn" value="注册" id="butn"/></p>
                </form>
            </div>
        </section>
    </div>
</article>

<footer>
    <p class="decro">本站所有资源信息均由网友上传,本站只是为了推广资源让更多读者下载,使用。如涉侵权，请联系管理员</p>
    <p class="cr">Copyright © 2021-2025 <span class="site">爱下载资源分享平台</span> All Rights Reserved.</p>
    <p class="num">沪ICP备14048333号</p>
</footer>

</body>

</html>